package com.joven.interface1.service.impl;

import com.joven.core.model.User;
import com.joven.core.service.ProductService1;
import com.joven.interface1.localService.TestService;
import com.joven.interface1.mapper.TestMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;


import java.util.ArrayList;
import java.util.List;

/**
 * @author joven_wong
 * 2021/5/30 12:34
 * 暴露服务注解 使用dubbo提供的@Service
 */
@Service(version = "1.0.0", group = "test")
public class ProductServiceImpl implements ProductService1 {


    @Autowired
    TestMapper testMapper;

    @Autowired
    TestService testService;

//    @Autowired
//    public void setUserMapper(UserMapper userMapper){
//        this.userMapper = userMapper;
//    }

    @Override
    public List<User> getAllUsers() {
        User one = new User();one.setName("No_DAO");
        User two = new User();two.setName("TEST_DUBBO");

        List<User> lists = new ArrayList<>();
        lists.add(one);
        lists.add(two);
        return lists;
    }

    //接口放公共层，本地连接数据库
    @Override
    public User getOneById(Long id) {
        return testService.getOneById(id);
//        return testMapper.selectById(id);
    }
}
